﻿#include<iostream>
#include<asio.hpp>
using namespace std;
using asio::ip::tcp;
int main()
{
	try
	{
		//创建服务
		asio::io_service io_service;
		//创建socket

		tcp::socket socket(io_service);
		socket.connect(tcp::endpoint(asio::ip::make_address("127.0.0.1"), 13));
		
		std::string message;
		message.resize(1024);

		auto len = socket.read_some(asio::buffer(message));
		std::cout << "len " << len << " message:" << message << std::endl;


		//运行服务
		io_service.run();
	}
	catch (const std::exception& e)
	{
		std::cout << "has exception " << e.what() << std::endl;
	}
	return 0;
}